﻿
Imports std

Public Module file_directory2
    Public Function combinepath2(ByRef rst As String, ByVal s As vector(Of String)) As Boolean
        If Not s Is Nothing Then
            Return combinepath(rst, s.data())
        Else
            Return False
        End If
    End Function

    Public Function combinepath2(ByVal s As vector(Of String)) As String
        If Not s Is Nothing Then
            Return combinepath(s.data())
        Else
            Return Nothing
        End If
    End Function

    Public Class unittests
        Public Shared Sub combinepath()
            While True
                Console.WriteLine("input paths, end with $")
                Dim s As vector(Of String) = Nothing
                s = New vector(Of String)()
                Dim input As String = Nothing
                input = Console.ReadLine()
                While Not input Is Nothing AndAlso input <> "$"
                    s.push_back(input)
                    input = Console.ReadLine()
                End While

                Dim rst As String = Nothing
                If combinepath2(rst, s) Then
                    Console.WriteLine(rst)
                Else
                    Console.WriteLine("cannot combine path.")
                End If
                If input Is Nothing Then
                    Exit While
                End If
            End While
        End Sub
    End Class
End Module
